/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.statemachine.figure;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;

/**
 * PseudostateChoiceFigure.
 * 
 * @author David Servat
 * @since 10 apr. 07
 */
public class PseudostateChoiceFigure extends Shape{
 
	/**
     * Default Constructor.
     */
    public PseudostateChoiceFigure(){
        super();

        setLineWidth(2);
    }

    /**
     * Does nothing.
     * @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphics)
     */
    @Override
    protected void fillShape(Graphics graphics){
    }

    /**
     * @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics)
     */
    @Override
    protected void outlineShape(Graphics graphics){
        Rectangle f = Rectangle.SINGLETON;
        Rectangle r = getBounds();
        f.x = r.x + lineWidth / 2;
        f.y = r.y + lineWidth / 2;
        f.width = r.width - lineWidth;
        f.height = r.height - lineWidth;

        PointList pl = new PointList();
        pl.addPoint(f.getTop());
        pl.addPoint(f.getRight());
        pl.addPoint(f.getBottom());
        pl.addPoint(f.getLeft());

        graphics.drawPolygon(pl);
    }
}